import java.io.File;
import java.io.IOException;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        /*File file = new File("d:/test.txt");//不要求真实存在
        System.out.println(file.getParent());//  d:\
        System.out.println(file.getName());//  test.txt
        System.out.println(file.getPath());//  d:\test.txt
        System.out.println(file.getAbsolutePath());//  d:\test.txt
        System.out.println(file.getCanonicalPath());//  D:\test.txt*/

        File file = new File("./test.txt");//不要求真实存在
        System.out.println(file.getParent());//  .
        System.out.println(file.getName());//  test.txt
        System.out.println(file.getPath());//  .\test.txt
        System.out.println(file.getAbsolutePath());//  C:\测开\4.JavaEE\代码\2.IO\.\test.txt
        System.out.println(file.getCanonicalPath());//  C:\测开\4.JavaEE\代码\2.IO\test.txt

    }
}
